import axios from '@/request'
import { queryParams } from '@/utils'

export function getOrderListApi(page, query = {}) {
  let q = queryParams(query, true)
  return axios.get(`/admin/order/${page}${q}`)
}

export function deleteOrderApi(ids) {
  return axios.post(`/admin/order/delete_all`, { ids })
}

export function shipOrderApi(id, data) {
  return axios.post(`/admin/order/${id}/ship`, data)
}

export function refundOrderApi(id, data) {
  return axios.post(`/admin/order/${id}/handle_refund`, data)
}

export function exportOrderApi(query = {}) {
  let q = queryParams(query, true)
  return axios.post(`/admin/order/excelexport${q}`, {}, {
    token: true,
    responseType: 'blob'
  })
}

export function getShipInfoApi(id) {
  return axios.get(`/admin/order/${id}/get_ship_info`)
}